package cate.common.table.limittimegift;

import cate.common.table.ESheet;
import cate.common.util.TimeTool;

import java.util.ArrayList;
import java.util.List;

public class LimitTimeGiftSheet extends ESheet<LimitTimeGiftRow> {
    @Override
    public String getSheetName() {
        return "限时礼包";
    }


    /**
     * 根据玩家当前的等级和vip等级获取可以推送的礼包
     */
    public List<Integer> getGiftTid(int level, int vip, int distanceDay) {
        List<Integer> tids = new ArrayList<>();
//        int distanceDay = TimeTool.getDistanceDays(openTime, System.currentTimeMillis());
        for (LimitTimeGiftRow row : this.getList()) {
            if (level >= row.levelMin
                    && level <= row.levelMax
                    && vip >= row.vipMin
                    && vip <= row.vipMax
                    && distanceDay <= row.endDay
                    && distanceDay >= row.startDay
            ) {
                tids.add(row.tid);
            }
        }
        return tids;
    }

}
